package lab03.Test09;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
/**
 * Created by 李晓容 on 2017/12/13.
 */


    public class Test {
        public static void main(String[] args)throws IOException {
            Book a1=new Book("1001","Java程序设计","第2版", 56.9f,560);
            Book a2=new Book("1002","Java开发实战","第1版", 98.9f,820);
            Book a3=new Book("1003","C++程序设计指南","第3版", 62.5f,362);
            Book a4=new Book("1004","EJB3.0入门经典","第1版", 59.8f,1280);
            Book a5=new Book("1005","Spring3.0 in Action","第3版", 95.8f,1189);

            Book book[]={a1,a2,a3,a4,a5};
            String a="编号\t名称\t\t版本\t价格\t销售额\r\n";
            for (int i=0;i<book.length;i++){
                a=a+book[i]+"\r\n";
            }
            File file=new File("e"+File.separator+"book.txt");
            Writer out=null;
            out=new FileWriter(file);
            out.write(a);
            out.close();
        }
    }

